import React, { Component } from "react";

class Dismiss extends Component{
    constructor(props){
        super(props)
        this.state = {
            list:"abcdefg".split("")
        }
    }

    onDismiss(i){
        this.state.list.splice(i,1)
    }

    render(){
        return (
            <div>
                <h1>列表</h1>
                <ul>
                    {this.state.map((n, i)=>(
                        <li>{n} <button 
                                    onClick={()=>this.onDismiss(i)} 
                                    type="button"
                                ></button>
                        </li>
                    ))}
                </ul>
            </div>
        )
    }
}

render(<Dismiss/>, window.document.getElementById('app'));
